#include <iostream>
#include <string>
#define int long long
#define endl '\n'
#define debug(x) cout << #x << " = " << x << '\n'
#define INF 0x3f3f3f3f3f3f3f3f
using namespace std;

#define N 50050

int n;
int tr[N];

int lowbit(int x)
{
	return x & -x;
}

void modify(int x, int c)
{
	for (int i = x; i <= n; i += lowbit(i)) tr[i] += c;
}

int sum(int x)
{
	int res = 0;
	for (int i = x; i > 0; i -= lowbit(i)) res += tr[i];
	return res;
}

void solve()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int a;
		cin >> a;
		modify(i, a);
	}
	string op;
	int i, j;
	while (cin >> op, op != "End")
	{
		cin >> i >> j;
		if (op == "Add") modify(i, j);
		else if(op == "Sub") modify(i, -j);
		else if (op == "Query")
		{
			int res = sum(j) - sum(i - 1);
			cout << res << endl;
		}
	}
}

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	cin >> t; 
	while (t--)
	{
		cout << "Case 1:" << endl;
		solve();
	}
	return 0;
}